From 989deaaeff3bd3934c026b5e29b91b4beaebbcf5 Mon Sep 17 00:00:00 2001 From: robertl Date: Fri, 10 Nov 2006 01:39:05 +0000 Subject: [PATCH] Use the Windows-proprietary MoveFileEx to rename files in KML writer for atomicity. git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@2491 f51c46e8-681c-474f-0cfe-069cfd0219fb --- gpsbabel/kml.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/gpsbabel/kml.c b/gpsbabel/kml.c index cd92713a0..8178a3f95 100644 --- a/gpsbabel/kml.c +++ b/gpsbabel/kml.c @@ -288,15 +288,8 @@ kml_wr_deinit(void) if (posnfilenametmp) { #if __WIN32__ - /* - * This is gross. - * Windows does not offer an atomic rename; we must - * explictly remove the destination here which exposes - * a window where a polled reader of this file could find - * the file to be missing. Windows readers will simply - * have to retry on this case. - */ - _unlink(posnfilename); + MoveFileEx(posnfilenametmp, posnfilename, + MOVEFILE_REPLACE_EXISTING); #endif rename(posnfilenametmp, posnfilename); xfree(posnfilenametmp); -- 2.30.2